<?php
class UserController extends Controller {
    private $userModel;
    
    public function __construct() {
        // 加载用户模型
        require_once ROOT_PATH . '/app/models/User.php';
        $this->userModel = new User();
    }
    
    // 用户列表页
    public function list() {
        $users = $this->userModel->getUsers();
        
        $this->render('list', [
            'title' => '用户列表',
            'users' => $users
        ]);
    }
    
    // 用户详情页
    public function detail() {
        $id = isset($_GET['id']) ? $_GET['id'] : 1;
        $user = $this->userModel->getUserById($id);
        
        $this->render('detail', [
            'title' => '用户详情',
            'user' => $user
        ]);
    }
}
?>